Technical Field
This disclosure is directed to processors, and more particularly, to method and apparatus embodiments for handling predicate calculation for branch instructions.
Description of the Related Art
Many modern processors utilize execution techniques such as branch prediction and branch predication to increase performance. Branch prediction is a technique in which the result of an instruction having a conditional branch is predicted in advance. Instructions following the branch instruction in the predicted path may be speculatively executed. If the prediction is correct, the results of the speculatively executed instructions are available to commit to registers as soon as they are needed. Otherwise, the results obtained from speculative execution of the instructions in the predicted path are discarded, while the instructions in the correct path may be executed.
As an alternative to branch prediction, branch predication is a technique in which instructions for both possible paths of a conditional branch are speculatively executed. The correct path may be subsequently determined by execution of the instruction having the conditional branch. Once the correct path is determined, the results from the corresponding instructions may be committed to registers, while the results from instructions in the incorrect path may be discarded.
For some instructions, flag bits may be set during their execution. Condition codes may also be associated with certain instructions. For those instructions having conditional branches, the condition codes indicate which flags are to be checked to determine whether a branch is taken. In some instruction set architectures, instructions that set flags and check the flags according to condition codes may be combined. Thus, the setting of a flag and the determination of a particular condition may occur in a single cycle. Such combined instructions may be used for branch predication.